<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <style>
        html, body {
            background-color: #f8f8f8;
        }
        .main {
        	background-color: #fff;
        }
        .main ul li .li_box {
        	height: 50px;
        	line-height: 50px;
        	padding: 0 15px;
        	display: -webkit-box;
        	display: -webkit-flex;
        	border-bottom: 1px solid #e8e8e8;
        }
        .main ul li:last-child .li_box {
        	border-bottom: none;
        }
        .main ul li .li_box .li_boxl {
        	color: #333;
        	font-size: 15px;
        }
        .main ul li .li_box .li_boxr {
        	font-size: 14px;
        	color: #999;
        	flex: 1;
        	-webkit-flex: 1;
        	box-flex: 1;
        	-webkit-box-flex: 1;
        	text-align: right;
        	display: -webkit-box;
        	-webkit-box-align: center;
        	-webkit-box-pack: end;
        }
        .main ul li .li_box .li_boxr img {
        	height: 13px;
        	display: block;
        }
    </style>
</head>
<body>
    <div class="main">
    	<ul>
    		<li tapmode onclick="fnModifyPassword();">
    			<div class="li_box">
    				<div class="li_boxl">修改密码</div>
    				<div class="li_boxr">
    					<img src="../image/right.png">
    				</div>
    			</div>
    		</li>
    		<li onclick="clearCache();" tapmode>
    			<div class="li_box">
    				<div class="li_boxl">清除缓存</div>
    				<div class="li_boxr cache_num"></div>
    			</div>
    		</li>
    		<li tapmode onclick="fnCheckUpdate();" style="display: none;">
    			<div class="li_box">
    				<div class="li_boxl">检查更新</div>
    				<div class="li_boxr">
    					<img src="../image/right.png">
    				</div>
    			</div>
    		</li>
    	</ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript">
    apiready = function(){
        setCacheSize();
    };

    // 修改密码
    function fnModifyPassword() {
        api.openWin({
            name: 'modify_password',
            url: 'modify_password.html'
        });
    }

    // 检查更新
    function fnCheckUpdate() {
        api.openWin({
            name: 'check_update',
            url: 'check_update.html'
        });
    }

    function clearCache() {
        api.clearCache(function( ret, err ){
            if( ret ){
                // setCacheSize(); 
                $('.cache_num').text('0.0M');
                api.toast({
                    msg: '清除成功',
                    location:'middle'
                });
            }  
        });

    }

    function setCacheSize() {
        api.getCacheSize(function( ret, err ){
            if( ret ){
                var cacheSize = ret.size/1024/1024;
                cacheSize = cacheSize.toFixed(1)+'M';
                $('.cache_num').text(cacheSize);
            }
        });
    }
</script>
</html>